/*
 * Copyright (c) 2013-2015 Charkey. All rights reserved.
 *
 * This software is the confidential and proprietary information of Charkey.
 * You shall not disclose such Confidential Information and shall use it only
 * in accordance with the terms of the agreements you entered into with Charkey.
 *
 * Charkey MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE SOFTWARE,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
 *
 * Charkey SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING,
 * MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
 */

package cn.simastudio.talos.inter.service.inst.impl;

import cn.simastudio.talos.core.aop.annotation.Logging;
import cn.simastudio.talos.core.exception.biz.DataDeleteException;
import cn.simastudio.talos.inter.mapper.inst.DemoCountryMapper;
import cn.simastudio.talos.inter.mapper.inst.DemoUserMapper;
import cn.simastudio.talos.inter.model.inst.DemoCountry;
import cn.simastudio.talos.inter.model.inst.DemoUser;
import cn.simastudio.talos.inter.service.inst.DemoService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Usage:
 *
 * @author Charkey
 * @date 2015/7/18 14:28
 */
@Service
public class DemoServiceImpl implements DemoService {

    private static final Logger LOGGER = LoggerFactory.getLogger(DemoServiceImpl.class);

    @Autowired
    private DemoCountryMapper demoCountryMapper;

    @Autowired
    private DemoUserMapper demoUserMapper;

    public DemoCountry selectByPrimaryKey(int countryId) {
        return demoCountryMapper.selectByPrimaryKey(countryId);
    }

    public HashMap<String, Object> selectByPrimaryKeyReturnMap(int countryId) {
        return demoCountryMapper.selectByPrimaryKeyReturnMap(countryId);
    }

    public int insert(DemoCountry demoCountry) {
        return demoCountryMapper.insert(demoCountry);
    }

    public int insertSelective(DemoCountry demoCountry) {
        return demoCountryMapper.insertSelective(demoCountry);
    }

    public DemoUser getUser1(int userId) {
        return demoUserMapper.getUser1(userId);
    }

    public List<DemoCountry> selectByNameLike(String countryName) {
        return demoCountryMapper.selectByNameLike(countryName);
    }

    public List<DemoCountry> selectByNameLikeTraditional(String countryName) {
        return demoCountryMapper.selectByNameLikeTraditional(countryName);
    }

    public Integer selectByNameLikeTraditionalCount(String countryName) {
        return demoCountryMapper.selectByNameLikeTraditionalCount(countryName);
    }

    public List<DemoCountry> selectByOrder(String orderBy) {
        return demoCountryMapper.selectByOrder(orderBy);
    }

    public List<DemoCountry> selectByOrder2(String orderBy) {
        return demoCountryMapper.selectByOrder2(orderBy);
    }

    public List<DemoCountry> selectOptionalColumns(String... columns) {
        return demoCountryMapper.selectOptionalColumns(columns);
    }

    public List<DemoCountry> selectNotInIds(List<Integer> ids, String orderBy) {
        return demoCountryMapper.selectNotInIds(ids, orderBy);
    }

    public List<DemoCountry> selectByWhereMap(Map paramMap) {
        return demoCountryMapper.selectByWhereMap(paramMap);
    }

    @Logging
    public int deleteByPrimaryKey(int id) {
        Integer integer = demoCountryMapper.deleteByPrimaryKey(id);
        LOGGER.debug("deleted: {}", integer);
        throw new DataDeleteException();
    }

    public List<DemoCountry> selectAllIdsInArray(Integer[] params) {
        return demoCountryMapper.selectAllIdsInArray(params);
    }

    public List<DemoCountry> selectAllIdsInList(List<Integer> params) {
        return demoCountryMapper.selectAllIdsInList(params);
    }

    public List<DemoCountry> selectAllIdsNotInMap(Map paramMap) {
        return demoCountryMapper.selectAllIdsNotInMap(paramMap);
    }

    public DemoUser getUser2(int id) {
        return demoUserMapper.getUser2(id);
    }

    public DemoUser getUser3(int id) {
        return demoUserMapper.getUser3(id);
    }

    public int updateByPrimaryKey(DemoCountry demoCountry) {
        return demoCountryMapper.updateByPrimaryKey(demoCountry);
    }


}
